package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TTecInnovInfoTemp;
import cn.com.headfree.mouldshow.dao.TTecInnovInfoTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tTecInnovInfoTempDao")
public class TTecInnovInfoTempDaoImpl extends BaseDaoImpl<TTecInnovInfoTemp> implements TTecInnovInfoTempDao {


    @Override
    public void saveInfo(TTecInnovInfoTemp tTecInnovInfo) {
        String sql = "insert into t_tec_innov_info_temp (id,achi_name,sumary,award_name,award_date,award_org,award_level,award_grade,group_name,member_name,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,business_type_id,primitive_id) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{achi_name,jdbcType=VARCHAR},")
                .append("#{sumary,jdbcType=VARCHAR},").append("#{award_name,jdbcType=VARCHAR},")
                .append("#{award_date,jdbcType=DATE},").append("#{award_org,jdbcType=VARCHAR},")
                .append("#{award_level,jdbcType=VARCHAR},").append("#{award_grade,jdbcType=VARCHAR},")
                .append("#{group_name,jdbcType=VARCHAR},").append("#{member_name,jdbcType=VARCHAR},")
                .append("#{org_id,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
                .append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
                .append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
                .append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
                .append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},")
                .append("#{orignal_id,jdbcType=VARCHAR},").append("#{business_type_id,jdbcType=VARCHAR},")
                .append("#{primitive_id,jdbcType=VARCHAR})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tTecInnovInfo.getId());
        params.put("achi_name", tTecInnovInfo.getAchiName());
        params.put("sumary", tTecInnovInfo.getSumary());
        params.put("award_name", tTecInnovInfo.getAwardName());
        params.put("award_date", tTecInnovInfo.getAwardDate());
        params.put("award_org", tTecInnovInfo.getAwardOrg());
        params.put("award_level", tTecInnovInfo.getAwardLevel());
        params.put("award_grade", tTecInnovInfo.getAwardGrade());
        params.put("group_name", tTecInnovInfo.getGroupName());
        params.put("member_name", tTecInnovInfo.getMemberName());
        params.put("org_id", tTecInnovInfo.getOrgId());
        params.put("creater_id", tTecInnovInfo.getCreaterId());
        params.put("creater_name", tTecInnovInfo.getCreaterName());
        params.put("create_time", new Timestamp(new Date().getTime()));
        params.put("updater_id", tTecInnovInfo.getUpdaterId());
        params.put("updater_name", tTecInnovInfo.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        params.put("del_sign", 0);
        params.put("is_valid", tTecInnovInfo.getIsValid());
        params.put("audit_state", tTecInnovInfo.getAuditState());
        params.put("orignal_id", tTecInnovInfo.getOrignalId());
        params.put("business_type_id", tTecInnovInfo.getBusinessTypeId());
        params.put("primitive_id", tTecInnovInfo.getPrimitiveId());
        this.executeSql(sqlBuilder.toString(), params);
    }
}
